<div id="content">

    <div class="container-fluid">
    <hr>
    <div class="row-fluid">
      <div class="span12">

        <div class="controls controls-row">
          <form name="orderCond" method="post">
                <input style="display:none;" type="text" value="{:U('Order/index?condition=1')}" name="pay_status_b" />
                <input style="display:none;" type="text" value="{:U('Order/index?condition=2')}" name="pay_type_b" />
                <input style="display:none;" type="text" value="{:U('Order/index?condition=3')}" name="time" />
                <input style="display:none;" type="text" value="{:U('Order/index?condition=4')}" name="order_sn_b" />
                <input style="display:none;" type="text" value="{:U('Order/index?condition=5')}" name="sellerID_b" />
                <input style="display:none;" type="text" value="{:U('Order/index?condition=6')}" name="order_status_b" />

                <a class="btn btn-primary" style="float:left;" href="{:U('Order/index')}">所有信息</a>

              <select name="order_status" class="span2" onchange="sub_pay_status(6)">
                  <option selected="selected"> -- 订单状态 -- </option>
                  <option value="0">未成功</option>
                  <option value="2">成功</option>
              </select>
              <script>
                  var order_status={$order_status};
                  if(typeof(order_status)=='number'){
                      $("select[name='order_status']").children("option").each(
                              function(){
                                  if($(this).val()==order_status)
                                  {
                                      $(this).attr("selected","selected");
                                  }
                              }
                      );
                  }
              </script>

                <select name="pay_status" class="span2" onchange="sub_pay_status(1)">
                    <option selected="selected"> -- 支付状态 -- </option>
                    <option value="0">未付款</option>
                    <option value="1">付款中</option>
                    <option value="2">已付款</option>
                    <option value="all">全部订单</option>
                </select>
                  <script>
                      var pay_status={$pay_status};
                      if(typeof(pay_status)=='number'){
                          $("select[name='pay_status']").children("option").each(
                                  function(){
                                      if($(this).val()==pay_status)
                                      {
                                          $(this).attr("selected","selected");
                                      }
                                  }
                          );
                      }
                  </script>
                <select name="pay_type" class="span2" onchange="sub_pay_status(2)">
                    <option selected="selected"> -- 支付方式 -- </option>
                    <option value="0">货到付款</option>
                    <option value="1">微信支付</option>
                    <option value="2">门店自提</option>
                    <option value="all">全部订单</option>
                </select>
                  <script>
                      var pay_type={$pay_type};
                      if(typeof(pay_type)=='number') {
                          $("select[name='pay_type']").children("option").each(
                                  function(){
                                      if($(this).val()==pay_type)
                                      {
                                          $(this).attr("selected","selected");
                                      }
                                  }
                          );
                      }
                  </script>
                <input name="order_sn" class="span2" value="" onblur="sub_pay_status(4)" placeholder="订单编码"/>

                <input style="width:100px;" name="endTime" readonly="readonly" type="text" data-date-format="mm-dd-yyyy" class="datepicker span2" placeholder="时间范围(止)" onclick="sub_pay_status(3)">
                <input style="width:100px;" name="startTime" readonly="readonly" type="text" data-date-format="mm-dd-yyyy" class="datepicker span2" placeholder="时间范围(起)" onclick="sub_pay_status(3)">


                <div style="border:1px solid #FFFFFF; margin-top:10px; float:left; width:100%;">
                    <label>用于商户对账</label>
                    <input name="startTime_b" readonly="readonly" type="text" data-date-format="mm-dd-yyyy" class="datepicker span2" placeholder="时间范围(起)">
                    <input name="endTime_b" readonly="readonly" type="text" data-date-format="mm-dd-yyyy" class="datepicker span2" placeholder="时间范围(止)">
                    <select name="sellerID" class="span2">
                        <option selected="selected"> -- 商户 -- </option>
                        <volist name="seller" id="ko">
                            <option value="{$ko.id}">{$ko.nick}</option>
                        </volist>
                    </select>
                    <input type="button" value="提交" onclick="sub_pay_status(5)"/>
                </div>

          </form>
        </div>
        <script>
            function sub_pay_status(action)
            {

                if(action==1)
                {
                    var url=$("input[name='pay_status_b']").val();
                    document.orderCond.action=url;
                    orderCond.submit();
                }
                else if(action==2)
                {
                    var url=$("input[name='pay_type_b']").val();
                    document.orderCond.action=url;
                    orderCond.submit();
                }
                else if(action==3)
                {
                    var startTime=$("input[name='startTime']").val();
                    var endTime=$("input[name='endTime']").val();
                    if(startTime!=""&&endTime!="")
                    {
                        var url=$("input[name='time']").val();
                        document.orderCond.action=url;
                        orderCond.submit();
                    }
                }
                else if(action==4)
                {
                    if($("input[name='order_sn']").val()!="")
                    {
                        var url = $("input[name='order_sn_b']").val();
                        document.orderCond.action = url;
                        orderCond.submit();
                    }
                }
                else if(action==5)
                {
                    var startTimeB=$("input[name='startTime_b']").val();
                    var endTimeB=$("input[name='endTime_b']").val();
                    var sellerID=$("input[name='seller']").val();
                    if(startTimeB!=""&&endTimeB!=""&&sellerID!="")
                    {
                        var url=$("input[name='sellerID_b']").val();
                        document.orderCond.action=url;
                        orderCond.submit();
                    }
                }
                else if(action==6)
                {
                    if($("input[name='order_status']").val()!="")
                    {
                        var url = $("input[name='order_status_b']").val();
                        document.orderCond.action = url;
                        orderCond.submit();
                    }
                }
            }

        </script>
        <div class="widget-box">
          <div class="widget-title"><span class="icon">
            <input type="checkbox" id="title-checkbox" name="title-checkbox" />
            </span>
            <h5>Static table with checkboxes</h5>
          </div>
          <div class="widget-content nopadding">
            <table class="table table-bordered table-striped with-check">
                  <thead>
                        <tr>
                            <th><i class="icon-resize-vertical"></i></th>
                            <th>ID</th>
                            <th>order_sn</th>
                            <th>购买者</th>
                            <th>订单状态</th>
                            <th>支付状态</th>
                            <th>支付方式</th>
                            <th>下单时间</th>
                            <th>地址</th>
                        </tr>
                  </thead>

                <volist name="arr" id="vo">
                    <tbody>
                        <tr>
                            <td><input type="checkbox" /></td>
                            <td>{$vo.id}</td>
                            <td><a href="{:U('Order/orderInfo',array('id'=>$vo[id]))}">{$vo.order_sn}</a></td>
                            <td class="center">{$vo.username}</td>
                            <td>{$vo.order_status_b}</td>
                            <td>{$vo.pay_status_b}</td>
                            <td>{$vo.pay_type_b}</td>
                            <td>{$vo.add_time_b}</td>
                            <td>{$vo.address}</td>
                        </tr>
                    </tbody>
                </volist>
                总价钱：{$sumAmount} | 订单数量：{$countOrderNum}
            </table>
              <script>
                  function orderInfo(sn)
                  {
                      var orderSN=sn;

                      $.ajax({
                          url:"{:U('Order/orderInfo')}",

                          type: 'POST',

                          data:{
                              order_sn:orderSN
                          },

                          dataType: 'html',

                          timeout: 1000,

                          error: function(){alert('Error loading PHP document');},

                          success: function(result){
                              var one=result.split("/");
                              var floatWindow=$(".floatWindow ul li");

                              for(var i=0;i<=floatWindow.length;i++)
                              {
                                  var a=floatWindow.children("span").eq(i).text(one[i]);
                              }
                              $(".floatWindow").show();
                          }
                      });
                  }
              </script>
          </div>
        </div>
          {$page}
      </div>
    </div>
  </div>
</div>
<script src="__PUBLIC__js/fullcalendar.min.js"></script>
<script src="__PUBLIC__js/matrix.calendar.js"></script>
<script src="__PUBLIC__js/matrix.tables.js"></script>